package com.jhhc.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class FileParser {
    public static void main(String[] args) {
        String filePath = "E:\\work\\RiverStrong\\相关项目\\江苏项目\\图层文件\\线图层（江苏省界及长江）\\江苏省界.MIF"; // 替换为你的文件路径

        try {
            StringBuilder stringBuilder = new StringBuilder();
            BufferedReader reader = new BufferedReader(new FileReader(filePath));
            String line;

            while ((line = reader.readLine()) != null) {
                if (line.equals("Pline 20649")) {
                    // 找到目标行，开始拼接下面的行
                    while ((line = reader.readLine()) != null && !line.equals("Pline 20649")) {
                        stringBuilder.append(line).append(";");
                    }
                    break; // 结束循环
                }
            }

            reader.close();

            String result = stringBuilder.toString();
            System.out.println(result); // 输出拼接后的内容
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}